package Test;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Random;

/**
 * Date: 2023-04-24
 * Time: 9:19
 */
public class Test1 {
    public static void main(String[] args) {
          /* 班级里有N个学生，学生属性:姓名，年龄，性别。
        实现随机点名器。*/

        // 定义集合
        ArrayList<String> list = new ArrayList<>();

        // 添加元素
        Collections.addAll(list,"范闲","范建","范统","杜子腾","杜琦燕","宋合泛","侯笼藤","朱益群","朱穆朗玛峰","袁明媛");

        // 随机
        Random ran = new Random();

        int index = ran.nextInt(list.size());

        String str = list.get(index);

        System.out.println(str);
    }
}
